package lossy;

public class LPFilter {

	public static double[][] performLowPassFilter(double[][] in, int n){
		double[][] out = in;
		double d = 9.0;
		double dd = 9.0;
		for(int i = 1; i < n-1; i++){
			for(int j = 1; j < n-1; j++){
				out[i][j] = (
						in[i-1][j-1]/d + in[i-1][j+1]/d + 
						in[i-1][j]/d + in[i][j]/dd 
						+ in[i][j-1]/d + in[i][j+1]/d +
						in[i+1][j-1]/d + in[i+1][j+1]/d
						+ in[i+1][j]/d
								);
			}
		}
		
		return out;
	}
}
